package com.exam.Service;

import com.exam.Entity.AnswerInfo;
import com.exam.Entity.Student;
import com.exam.Mapper.AnswerInfoMapper;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AnswerInfoService {
    @Autowired
    private AnswerInfoMapper answerInfoMapper;

    public List<AnswerInfo> findTotal(int page, int size) {

        List<AnswerInfo> result = answerInfoMapper.findAll();

        return result;
    }
    public List<AnswerInfo> findAll(int page,int size) {
        //设置分页参数
        PageHelper.startPage(page, size);
        //执行查询
        List<AnswerInfo> answerInfos = answerInfoMapper.findAll();
        // 包装分页结果
        PageInfo<AnswerInfo> pageInfo = new PageInfo<>(answerInfos);

        return pageInfo.getList();
    }
}
